<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title',10)->comment('标题');
            $table->string('content',255)->comment('内容');
            $table->string('provider',32)->comment('发单者openid');
            $table->string('receiver',32)->comment('接单者openid');
            $table->unsignedDecimal('price')->comment('酬金');
            $table->unsignedTinyInteger('type')->comment('订单类别 0-跑腿 | 1-悬赏提问 | 2-学习辅导 | 3-生活服务 | 4-其他');
            $table->unsignedTinyInteger('status')->comment('订单状态 0-未发布 | 1-已发布 | 2-进行中 | 3-服务完成 | 4-评价完成 | 5-订单取消');
            $table->timestamp('deadline')->nullable()->comment('过期时间');
            $table->string('phone',11)->comment('联系电话');
            $table->softDeletes();
            $table->timestamps();
            $table->index('provider');
            $table->index('receiver');
            $table->index('status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
